package java_persistence;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import domain.Services;

public interface TreatmentRecordMapper {
	
	// CREATES
	
	/**Saves a TreatmentRecord in the database
	 * @param d the date of the associated appointment
	 * @param pu the username of the associated patient
	 * @param du the username of the attending doctor
	 * @param nu the username of the attending nurse
	 * @param bps systolic blood pressure
	 * @param bpd diastolic blood pressure
	 * @param pulse pulse in beats per minute
	 * @param temp temperature in degrees fahrenheit 
	 * @param hi patient's height in inches
	 * @param wp patient's weight in pounds
	 * @param diag the attending doctor's diagnosis 
	 * @param n the attending doctor and nurse's notes
	 */
	public void create_treatment_record(
			@Param("date") String d,
			@Param("patient_username") String pu,
			@Param("doctor_username") String du,
			@Param("nurse_username") String nu,
			@Param("bp_systolic") Integer bps,
			@Param("bp_diastolic") Integer bpd,
			@Param("pulse") Integer pulse,
			@Param("temperature") Float temp,
			@Param("height_inches") Integer hi,
			@Param("weight_pounds") Integer wp,
			@Param("diagnosis") String diag,
			@Param("notes") String n );
	
	/**Adds a service to the treatment record for adding it to an invoice 
	 * @param d the date of the associated appointment 
	 * @param p the username of the patient
	 * @param sn the name of the service
	 */
	public void add_service_to_treatment_record( @Param("date") String d, 
												 @Param("patient") String p,
												 @Param("service_name") String sn);
	
	// RETRIEVES
	
	//public TreatmentRecord retrieve(@Param("date") String date, @Param("patient_username") String pu);
	public String get_attending_doctor_username(@Param("date") String date, @Param("patient_username") String pu);
	public String get_attending_nurse_username(@Param("date") String date, @Param("patient_username") String pu);
	public Integer get_bp_systolic(@Param("date") String date, @Param("patient_username") String pu);
	public Integer get_bp_diastolic(@Param("date") String date, @Param("patient_username") String pu);
	public Integer get_pulse(@Param("date") String date, @Param("patient_username") String pu);
	public Float get_temp(@Param("date") String date, @Param("patient_username") String pu);
	public Integer get_height_inches(@Param("date") String date, @Param("patient_username") String pu);
	public Integer get_weight_pounds(@Param("date") String date, @Param("patient_username") String pu);
	public String get_diagnosis(@Param("date") String date, @Param("patient_username") String pu);
	public String get_notes(@Param("date") String date, @Param("patient_username") String pu);
	public List<Services> get_invoice(@Param("date") String date, @Param("patient_username") String pu);
	public List<Integer> get_patient_weights(@Param("patient_username") String pu);
	public List<Float> get_prices_for_month(@Param("month") String month);
	
	// UPDATES
	
	/**Updates a treatment record.  Note that it is not possible to change the patient's username or the date of the associated appointment.  Attempting to do so will cause the data to be garbage or, more likely, will generate an error caused by violating mySQL integrity constraints
	 * @param d the date of the associated appointment
	 * @param pu the username of the patient 
	 * @param du the usernaem of the attending doctor
	 * @param nu the username of the attending nurse
	 * @param bps the systolic blood pressure
	 * @param bpd the diastolic blood pressure
	 * @param pulse the pulse in beats per minute 
	 * @param temp the temperature in degrees fahrenheit
	 * @param hi the patient's height in inches
	 * @param wp the patient's weight in pounds
	 * @param diag the doctor's diagnosis
	 * @param n the doctor and nurse's notes
	 */
	public void update_treatment_record(
			@Param("date") String d,
			@Param("patient_username") String pu,
			@Param("doctor_username") String du,
			@Param("nurse_username") String nu,
			@Param("bp_systolic") Integer bps,
			@Param("bp_diastolic") Integer bpd,
			@Param("pulse") Integer pulse,
			@Param("temperature") Float temp,
			@Param("height_inches") Integer hi,
			@Param("weight_pounds") Integer wp,
			@Param("diagnosis") String diag,
			@Param("notes") String n );
	
	
	// DELETES
	
	/**Deletes a treatment record from the database.
	 * 
	 * Note that it is unwise and often unlawful to delete medical records.  This method is provided primarily for testing purposes.
	 * 
	 * @param d the date of the associated appointment 
	 * @param pu the username of the patient.  
	 */
	public void delete_treatment_record(@Param("date") String d, @Param("patient_username") String pu);
	
	
}
